package org.kimoji.global.service;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.kimoji.entity.User;
import org.kimoji.global.tool.CacheTool;
import org.kimoji.personal.dao.PersonalDAO;
import org.kimoji.security.dao.SecurityDAO;
import org.kimoji.security.entity.Account;
import org.kimoji.security.tool.SecurityTool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.servlet.support.RequestContext;

import freemarker.template.ObjectWrapper;
import freemarker.template.TemplateMethodModel;
import freemarker.template.TemplateModelException;

public class PreloadDataService implements TemplateMethodModel{

	@Autowired
	private PersonalDAO personalDAO;
	@Autowired
	private SecurityDAO securityDAO;
	
	@Override
	public Object exec(List param) throws TemplateModelException {
		String token = (String)param.get(0);
		String userId = securityDAO.loadAuth(token);
		User user = personalDAO.getUserByUserId(userId);
		return user;
	}

}
